package com.tractorframework.core;

import java.lang.reflect.Field;

import android.content.Context;
import android.util.Log;

public class TractorUtil {
	
	public static int getId(Context context, String idString)
	{
		context = context.getApplicationContext();
		String name = context.getPackageName();
		try {
			Class clazz = context.getClassLoader().loadClass(name + ".R$id");
			Field field = clazz.getDeclaredField(idString);
			return field.getInt(null);
		} catch (Exception e) {
			Log.e(Constants.TAG, e.getMessage());
		}
		return -1;
	}
}
